import axios from 'axios'
import loading from '../util/loading.js'

const ajax = (config) => {
  loading.show()
  axios({
    url: config.url,
    method: config.method,
    data: config.data,
    params: config.params
  }).then(res=>{
    config.success(res.data)
    loading.hide()
  })
}

export default ajax
